<template>
    <div class="cmp cmp-dogeplayer" :id="id"></div>
</template>

<script>
export default {
  name: 'cmp-dogeplayer',
  props: {
    options: {
        type: Object,
        default: () => { return {} }
    }
  },
  data () {
    return {
        id: 'player_' + `${Math.random()}`.substring(2),
        dogeVideoObj: null,
    }
  },
  methods: {
    // 播放
    play () {
      this.dogeVideoObj = new window.DogePlayer({
        container: document.getElementById(this.id),
        nload: true,
        url: this.options.url || '',
        userId: 1,
        vcode: this.options.vcode || ''
      })
    },
    // 暂停
    pause () {
        this.dogeVideoObj && this.dogeVideoObj.pause()
    },
    // 销毁
    destroy () {
        this.dogeVideoObj && this.dogeVideoObj.destroy()
    }
  }
}
</script>

<style scoped lang="less">
@import "~@/assets/css/_mixins.less";
@import "~@/assets/css/_color.less";
.cmp-dogeplayer {
    display: block;
    width: 100%;
    height: 100%!important;
    background-color: #333;
}
</style>
